import 'package:battery_plus/battery_plus.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mode/ui/BottomBarDemo.dart';
import 'package:flutter_mode/ui/DataDealDemo.dart';
import 'package:flutter_mode/ui/DialogDemo.dart';
import 'package:flutter_mode/ui/SyncfusionDemo.dart';
import 'package:flutter_mode/utils.dart';
import 'package:quiver/strings.dart';
import 'refresh_list.dart';
import 'share_lib_demo.dart';

/// Created by wangk on 2019/1/14.
class MorePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _MorePageState();
  }
}
class _MorePageState extends State<MorePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: SingleChildScrollView(
      child: Wrap(
        spacing: 8,
        runSpacing: 4,
        children: [
          addTitle('未分类'),
          addAction('上下拉刷新', () => pushMaterial(context, RefreshListDemo())),
          addAction('分享库（Share）', () => pushMaterial(context, ShareLibDemo())),
          addAction(
              'toast、Alter and BottomSheet',
              () => pushMaterial(context, DialogDemo())),
          addAction('数据', () => pushMaterial(context, DataDealDemo())),
          addAction('BottomBar', () => pushMaterial(context, BottomBarDemo())),
          addAction('battery_plus', () async {
              final battery = Battery();
              print(await battery.batteryLevel);
          }),
          addAction('syncfusion', () => pushMaterial(context, SyncfusionDemo())),
        ],
      ),
    ));
  }

  addTitle(String title) {
    return Center(
      child: Text(title),
    );
  }

  addAction(String title, Function() action) {
    return ElevatedButton(
      onPressed: action,
      child: Text(title),
    );
  }
}
